<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<lv-collapse [lvType]="'simple'">
    <lv-collapse-panel [lvTitle]="'common_advanced_label'|i18n" [lvExpanded]="false">
        <lv-form [formGroup]="formGroup" [lvLabelColon]="isSlaDetail">
            <ng-container *ngIf="!isHyperdetect">
                <lv-form-item>
                    <lv-form-label>
                        {{'common_limit_rate_policy_single_label' | i18n}}
                        <i lv-icon="aui-icon-help" lv-tooltip="{{'common_limit_rate_policy_tip_label' | i18n}}"
                        lvTooltipTheme="light" lvTooltipPosition="right" class="configform-constraint" lvColorState='true'></i>
                    </lv-form-label>
                    <lv-form-control>
                        <ng-container *ngIf="isSlaDetail">
                            {{qosNames.length ? find(qosNames, {uuid: formGroup.value.qos_id}) ? find(qosNames, {uuid:
                            formGroup.value.qos_id})['label']: '--':'--'}}
                        </ng-container>
                        <ng-container *ngIf="!isSlaDetail">
                            <lv-select [lvOptions]="qosNames" formControlName="qos_id" lvValueKey="uuid" lvShowClear>
                            </lv-select>
                        </ng-container>
                    </lv-form-control>
                </lv-form-item>
                <lv-form-item>
                    <lv-form-label>
                        {{'protection_auto_indexing_label' | i18n}}
                        <i lv-icon="aui-icon-help" lv-tooltip="{{'protection_auto_index_tip_label' | i18n}}"
                            lvTooltipTheme="light" class="configform-constraint" lvColorState='true'></i>
                    </lv-form-label>
                    <lv-form-control>
                        <ng-container *ngIf="isSlaDetail">
                            {{formGroup.value.auto_index | textMap: 'Switch_Sla_Info_Status'}}
                        </ng-container>
                        <ng-container *ngIf="!isSlaDetail">
                            <lv-switch formControlName="auto_index"
                                [lvDisabled]="action === protectResourceAction.Modify">
                            </lv-switch>
                        </ng-container>
                    </lv-form-control>
                </lv-form-item>
                <lv-form-item>
                    <lv-form-label>
                        {{'protection_open_aggregation_label' | i18n}}
                    </lv-form-label>
                    <lv-form-control>
                        <ng-container *ngIf="isSlaDetail">
                            {{formGroup.value.open_aggregation | textMap: 'Switch_Sla_Info_Status'}}
                        </ng-container>
                        <ng-container *ngIf="!isSlaDetail">
                            <lv-switch formControlName="open_aggregation"></lv-switch>
                        </ng-container>
                    </lv-form-control>
                </lv-form-item>
                <lv-form-item>
                    <lv-form-label>
                        {{'protection_network_access_label' | i18n}}
                    </lv-form-label>
                    <lv-form-control>
                        <ng-container *ngIf="isSlaDetail">
                            {{formGroup.value.network_acceleration | textMap: 'Switch_Sla_Info_Status'}}
                        </ng-container>
                        <ng-container *ngIf="!isSlaDetail">
                            <lv-switch formControlName="network_acceleration"></lv-switch>
                        </ng-container>
                    </lv-form-control>
                </lv-form-item>
                <ng-container *ngIf="!isSlaDetail">
                    <lv-form-item>
                        <lv-form-label>{{'protection_auto_retry_label' | i18n}}</lv-form-label>
                        <lv-form-control>
                            <lv-switch formControlName="auto_retry"></lv-switch>
                            <ng-container *ngIf="formGroup.value.auto_retry">
                                <div class="aui-gutter-column-md"></div>
                                <lv-form-label lvRequired>
                                    {{'common_retry_times_label' | i18n}}
                                </lv-form-label>
                                <lv-form-control [lvErrorTip]="retryTimesErrorTip" class="groupInControl">
                                    <lv-group lvGutter='8px' class="lv-group-flex-start">
                                        <lv-group>
                                            <input lv-input formControlName="auto_retry_times" type="text"
                                                placeholder="1~5" class="backup-for-text" />
                                        </lv-group>
                                        <lv-group>
                                            <span class="configform-constraint">{{'common_times_label' | i18n}}</span>
                                        </lv-group>
                                    </lv-group>
                                </lv-form-control>
                                <div class="aui-gutter-column-md"></div>
                                <lv-form-label lvRequired>
                                    {{'common_waiting_time_label' | i18n}}
                                </lv-form-label>
                                <lv-form-control [lvErrorTip]="waitTimesErrorTip" class="groupInControl">
                                    <lv-group lvGutter='8px' class="lv-group-flex-start">
                                        <lv-group>
                                            <input lv-input formControlName="auto_retry_wait_minutes" type="text"
                                                placeholder="1~30" class="backup-for-text" />
                                        </lv-group>
                                        <lv-group>
                                            <span class="configform-constraint">{{'common_minutes_label' | i18n}}</span>
                                        </lv-group>
                                    </lv-group>
                                </lv-form-control>
                            </ng-container>
                        </lv-form-control>
                    </lv-form-item>
                </ng-container>
                <ng-container *ngIf="isSlaDetail">
                    <lv-form-item>
                        <lv-form-label>{{'protection_auto_retry_label' | i18n}}</lv-form-label>
                        <lv-form-control>
                            <ng-container *ngIf="!formGroup.value.auto_retry">
                                {{formGroup.value.auto_retry | textMap: 'Switch_Sla_Info_Status'}}
                            </ng-container>
                            <ng-container *ngIf="formGroup.value.auto_retry">
                                <ng-container *ngIf="i18n.isEn">
                                    {{'common_retry_times_label' | i18n: []:
                                    true}}{{formGroup.value.auto_retry_times}} {{'common_times_label' |
                                    i18n}}{{'common_comma_label'|i18n}}
                                    {{'common_waiting_time_label' | i18n: []:
                                    true}}{{formGroup.value.auto_retry_wait_minutes}} {{'common_minutes_label' | i18n}}
                                </ng-container>
                                <ng-container *ngIf="!i18n.isEn">
                                    {{'common_retry_times_label' | i18n: []:
                                    true}}{{formGroup.value.auto_retry_times}}{{'common_times_label' |
                                    i18n}}{{'common_comma_label'|i18n}}
                                    {{'common_waiting_time_label' | i18n: []:
                                    true}}{{formGroup.value.auto_retry_wait_minutes}}{{'common_minutes_label' | i18n}}
                                </ng-container>
                            </ng-container>
                        </lv-form-control>
                    </lv-form-item>
                </ng-container>
                <ng-container *ngIf="!isSlaDetail">
                    <lv-form-item>
                        <lv-form-label>{{'protection_synthetic_full_copy_period_label' | i18n}}</lv-form-label>
                        <lv-form-control>
                            <lv-switch formControlName="is_synthetic_full_copy_period"></lv-switch>
                            <ng-container *ngIf="formGroup.value.is_synthetic_full_copy_period">
                                <div class="aui-gutter-column-md"></div>
                                <lv-form-label lvRequired>
                                    {{'common_backup_label' | i18n}}
                                </lv-form-label>
                                <lv-form-control [lvErrorTip]="fullCopyPeriodErrorTip" class="groupInControl">
                                    <lv-group lvGutter='8px' class="lv-group-flex-start">
                                        <lv-group>
                                            <input lv-input formControlName="synthetic_full_copy_period" type="text"
                                                placeholder="1~100" class="backup-for-text" />
                                        </lv-group>
                                        <lv-group>
                                            <span class="configform-constraint">{{'common_times_label' | i18n}}</span>
                                        </lv-group>
                                    </lv-group>
                                </lv-form-control>
                            </ng-container>
                        </lv-form-control>
                    </lv-form-item>
                </ng-container>
                <ng-container *ngIf="isSlaDetail">
                    <lv-form-item>
                        <lv-form-label>{{'protection_synthetic_full_copy_period_label' | i18n}}</lv-form-label>
                        <lv-form-control>
                            <ng-container *ngIf="!formGroup.value.is_synthetic_full_copy_period">
                                {{formGroup.value.is_synthetic_full_copy_period | textMap: 'Switch_Sla_Info_Status'}}
                            </ng-container>
                            <ng-container *ngIf="formGroup.value.is_synthetic_full_copy_period">
                                {{'common_backup_label' | i18n:
                                []:true}}{{formGroup.value.synthetic_full_copy_period}}{{'common_times_label' | i18n}}
                            </ng-container>
                        </lv-form-control>
                    </lv-form-item>
                </ng-container>
            </ng-container>
            <ng-container *ngIf="isHyperdetect">
                <ng-container *ngIf="!isSlaDetail">
                    <lv-form-item>
                        <lv-form-label>
                            {{'protection_lock_no_anti_data_label' | i18n}}
                        </lv-form-label>
                        <lv-form-control>
                            <lv-switch formControlName="is_security_snap"></lv-switch>
                            <ng-container *ngIf="formGroup.value.is_security_snap">
                                <span class="aui-text-help-sm">
                                    {{'protection_anti_lock_enable_tip_label' | i18n}}
                                </span>
                            </ng-container>
                        </lv-form-control>
                    </lv-form-item>
                </ng-container>
                <ng-container *ngIf="isSlaDetail">
                    <lv-form-item>
                        <lv-form-label>{{'protection_lock_no_anti_data_label' | i18n}}</lv-form-label>
                        <lv-form-control>
                            {{formGroup.value.is_security_snap | textMap: 'Switch_Sla_Info_Status'}}
                        </lv-form-control>
                    </lv-form-item>
                </ng-container>
                <ng-container *ngIf="!isSlaDetail">
                    <lv-form-item>
                        <lv-form-label>{{'protection_auto_retry_label' | i18n}}</lv-form-label>
                        <lv-form-control>
                            <lv-switch formControlName="auto_retry"></lv-switch>
                            <ng-container *ngIf="formGroup.value.auto_retry">
                                <div class="aui-gutter-column-md"></div>
                                <lv-form-label lvRequired>
                                    {{'common_retry_times_label' | i18n}}
                                </lv-form-label>
                                <lv-form-control [lvErrorTip]="retryTimesErrorTip" class="groupInControl">
                                    <lv-group lvGutter='8px' class="lv-group-flex-start">
                                        <lv-group>
                                            <input lv-input formControlName="auto_retry_times" type="text"
                                                placeholder="1~5" class="backup-for-text" />
                                        </lv-group>
                                        <lv-group>
                                            <span class="configform-constraint">{{'common_times_label' | i18n}}</span>
                                        </lv-group>
                                    </lv-group>
                                </lv-form-control>
                                <div class="aui-gutter-column-md"></div>
                                <lv-form-label lvRequired>
                                    {{'common_waiting_time_label' | i18n}}
                                </lv-form-label>
                                <lv-form-control [lvErrorTip]="waitTimesErrorTip" class="groupInControl">
                                    <lv-group lvGutter='8px' class="lv-group-flex-start">
                                        <lv-group>
                                            <input lv-input formControlName="auto_retry_wait_minutes" type="text"
                                                placeholder="1~30" class="backup-for-text" />
                                        </lv-group>
                                        <lv-group>
                                            <span class="configform-constraint">{{'common_minutes_label' | i18n}}</span>
                                        </lv-group>
                                    </lv-group>
                                </lv-form-control>
                            </ng-container>
                        </lv-form-control>
                    </lv-form-item>
                </ng-container>
                <ng-container *ngIf="isSlaDetail">
                    <lv-form-item>
                        <lv-form-label>{{'protection_auto_retry_label' | i18n}}</lv-form-label>
                        <lv-form-control>
                            <ng-container *ngIf="!formGroup.value.auto_retry">
                                {{formGroup.value.auto_retry | textMap: 'Switch_Sla_Info_Status'}}
                            </ng-container>
                            <ng-container *ngIf="formGroup.value.auto_retry">
                                <ng-container *ngIf="i18n.isEn">
                                    {{'common_retry_times_label' | i18n: []:
                                    true}}{{formGroup.value.auto_retry_times}} {{'common_times_label' |
                                    i18n}}{{'common_comma_label'|i18n}}
                                    {{'common_waiting_time_label' | i18n: []:
                                    true}}{{formGroup.value.auto_retry_wait_minutes}} {{'common_minutes_label' | i18n}}
                                </ng-container>
                                <ng-container *ngIf="!i18n.isEn">
                                    {{'common_retry_times_label' | i18n: []:
                                    true}}{{formGroup.value.auto_retry_times}}{{'common_times_label' |
                                    i18n}}{{'common_comma_label'|i18n}}
                                    {{'common_waiting_time_label' | i18n: []:
                                    true}}{{formGroup.value.auto_retry_wait_minutes}}{{'common_minutes_label' | i18n}}
                                </ng-container>
                            </ng-container>
                        </lv-form-control>
                    </lv-form-item>
                </ng-container>
            </ng-container>
        </lv-form>
    </lv-collapse-panel>
</lv-collapse>
